home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / u_man / cat1 / perlpod.z / perlpod
Encoding:
Text File  |  2002-10-03  |  12.6 KB  |  397 lines

  1.  
  2.  
  3.  
  4. PPPPEEEERRRRLLLLPPPPOOOODDDD((((1111))))                                                          PPPPEEEERRRRLLLLPPPPOOOODDDD((((1111))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      perlpod - plain old documentation
  10.  
  11. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  12.      A pod-to-whatever translator reads a pod file paragraph by paragraph, and
  13.      translates it to the appropriate output format.  There are three kinds of
  14.      paragraphs:  verbatim, command, and ordinary text.
  15.  
  16.      VVVVeeeerrrrbbbbaaaattttiiiimmmm PPPPaaaarrrraaaaggggrrrraaaapppphhhh
  17.  
  18.      A verbatim paragraph, distinguished by being indented (that is, it starts
  19.      with space or tab).  It should be reproduced exactly, with tabs assumed
  20.      to be on 8-column boundaries.  There are no special formatting escapes,
  21.      so you can't italicize or anything like that.  A \ means \, and nothing
  22.      else.
  23.  
  24.      CCCCoooommmmmmmmaaaannnndddd PPPPaaaarrrraaaaggggrrrraaaapppphhhh
  25.  
  26.      All command paragraphs start with "=", followed by an identifier,
  27.      followed by arbitrary text that the command can use however it pleases.
  28.      Currently recognized commands are
  29.  
  30.          =head1 heading
  31.          =head2 heading
  32.          =item text
  33.          =over N
  34.          =back
  35.          =cut
  36.          =pod
  37.          =for X
  38.          =begin X
  39.          =end X
  40.  
  41.  
  42.      =pod
  43.  
  44.      =cut
  45.          The "=pod" directive does nothing beyond telling the compiler to lay
  46.          off parsing code through the next "=cut".  It's useful for adding
  47.          another paragraph to the doc if you're mixing up code and pod a lot.
  48.  
  49.      =head1
  50.  
  51.      =head2
  52.          Head1 and head2 produce first and second level headings, with the
  53.          text in the same paragraph as the "=headn" directive forming the
  54.          heading description.
  55.  
  56.      =over
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. PPPPEEEERRRRLLLLPPPPOOOODDDD((((1111))))                                                          PPPPEEEERRRRLLLLPPPPOOOODDDD((((1111))))
  71.  
  72.  
  73.  
  74.      =back
  75.  
  76.      =item
  77.          Item, over, and back require a little more explanation: "=over"
  78.          starts a section specifically for the generation of a list using
  79.          "=item" commands. At the end of your list, use "=back" to end it. You
  80.          will probably want to give "4" as the number to "=over", as some
  81.          formatters will use this for indentation.  This should probably be a
  82.          default. Note also that there are some basic rules to using =item:
  83.          don't use them outside of an =over/=back block, use at least one
  84.          inside an =over/=back block, you don't _have_ to include the =back if
  85.          the list just runs off the document, and perhaps most importantly,
  86.          keep the items consistent: either use "=item *" for all of them, to
  87.          produce bullets, or use "=item 1.", "=item 2.", etc., to produce
  88.          numbered lists, or use "=item foo", "=item bar", etc., i.e., things
  89.          that looks nothing like bullets or numbers. If you start with bullets
  90.          or numbers, stick with them, as many formatters use the first "=item"
  91.          type to decide how to format the list.
  92.  
  93.      =for
  94.  
  95.      =begin
  96.  
  97.      =end
  98.          For, begin, and end let you include sections that are not interpreted
  99.          as pod text, but passed directly to particular formatters. A
  100.          formatter that can utilize that format will use the section,
  101.          otherwise it will be completely ignored.  The directive "=for"
  102.          specifies that the entire next paragraph is in the format indicated
  103.          by the first word after "=for", like this:
  104.  
  105.           =for html <br>
  106.            <p> This is a raw HTML paragraph </p>
  107.  
  108.          The paired commands "=begin" and "=end" work very similarly to
  109.          "=for", but instead of only accepting a single paragraph, all text
  110.          from "=begin" to a paragraph with a matching "=end" are treated as a
  111.          particular format.
  112.  
  113.          Here are some examples of how to use these:
  114.  
  115.           =begin html
  116.  
  117.           <br>Figure 1.<IMG SRC="figure1.png"><br>
  118.  
  119.           =end html
  120.  
  121.           =begin text
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. PPPPEEEERRRRLLLLPPPPOOOODDDD((((1111))))                                                          PPPPEEEERRRRLLLLPPPPOOOODDDD((((1111))))
  137.  
  138.  
  139.  
  140.             ---------------
  141.             |  foo        |
  142.             |        bar  |
  143.             ---------------
  144.  
  145.           ^^^^ Figure 1. ^^^^
  146.  
  147.           =end text
  148.  
  149.          Some format names that formatters currently are known to accept
  150.          include "roff", "man", "latex", "tex", "text", and "html". (Some
  151.          formatters will treat some of these as synonyms.)
  152.  
  153.          And don't forget, when using any command, that the command lasts up
  154.          until the end of the ppppaaaarrrraaaaggggrrrraaaapppphhhh, not the line. Hence in the examples
  155.          below, you can see the empty lines after each command to end its
  156.          paragraph.
  157.  
  158.          Some examples of lists include:
  159.  
  160.           =over 4
  161.  
  162.           =item *
  163.  
  164.           First item
  165.  
  166.           =item *
  167.  
  168.           Second item
  169.  
  170.           =back
  171.  
  172.           =over 4
  173.  
  174.           =item Foo()
  175.  
  176.           Description of Foo function
  177.  
  178.           =item Bar()
  179.  
  180.           Description of Bar function
  181.  
  182.           =back
  183.  
  184.  
  185.      OOOOrrrrddddiiiinnnnaaaarrrryyyy BBBBlllloooocccckkkk ooooffff TTTTeeeexxxxtttt
  186.  
  187.      It will be filled, and maybe even justified.  Certain interior sequences
  188.      are recognized both here and in commands:
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. PPPPEEEERRRRLLLLPPPPOOOODDDD((((1111))))                                                          PPPPEEEERRRRLLLLPPPPOOOODDDD((((1111))))
  203.  
  204.  
  205.  
  206.          I<text>     italicize text, used for emphasis or variables
  207.          B<text>     embolden text, used for switches and programs
  208.          S<text>     text contains non-breaking spaces
  209.          C<code>     literal code
  210.          L<name>     A link (cross reference) to name
  211.                          L<name>             manual page
  212.                          L<name/ident>       item in manual page
  213.                          L<name/"sec">       section in other manual page
  214.                          L<"sec">            section in this manual page
  215.                                              (the quotes are optional)
  216.                          L</"sec">           ditto
  217.                      same as above but only 'text' is used for output.
  218.                      (Text can not contain the characters '|' or '>')
  219.                          L<text|name>
  220.                          L<text|name/ident>
  221.                          L<text|name/"sec">
  222.                          L<text|"sec">
  223.                          L<text|/"sec">
  224.  
  225.          F<file>     Used for filenames
  226.          X<index>    An index entry
  227.          Z<>         A zero-width character
  228.          E<escape>   A named character (very similar to HTML escapes)
  229.                          E<lt>               A literal <
  230.                          E<gt>               A literal >
  231.                          (these are optional except in other interior
  232.                           sequences and when preceded by a capital letter)
  233.                          E<n>                Character number n (probably in ASCII)
  234.                          E<html>             Some non-numeric HTML entity, such
  235.                                              as E<Agrave>
  236.  
  237.  
  238.      TTTThhhheeee IIIInnnntttteeeennnntttt
  239.  
  240.      That's it.  The intent is simplicity, not power.  I wanted paragraphs to
  241.      look like paragraphs (block format), so that they stand out visually, and
  242.      so that I could run them through fmt easily to reformat them (that's F7
  243.      in my version of vvvviiii).  I wanted the translator (and not me) to worry
  244.      about whether " or ' is a left quote or a right quote within filled text,
  245.      and I wanted it to leave the quotes alone, dammit, in verbatim mode, so I
  246.      could slurp in a working program, shift it over 4 spaces, and have it
  247.      print out, er, verbatim.  And presumably in a constant width font.
  248.  
  249.      In particular, you can leave things like this verbatim in your text:
  250.  
  251.          Perl
  252.          FILEHANDLE
  253.          $variable
  254.          function()
  255.          manpage(3r)
  256.  
  257.      Doubtless a few other commands or sequences will need to be added along
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. PPPPEEEERRRRLLLLPPPPOOOODDDD((((1111))))                                                          PPPPEEEERRRRLLLLPPPPOOOODDDD((((1111))))
  269.  
  270.  
  271.  
  272.      the way, but I've gotten along surprisingly well with just these.
  273.  
  274.      Note that I'm not at all claiming this to be sufficient for producing a
  275.      book.  I'm just trying to make an idiot-proof common source for nroff,
  276.      TeX, and other markup languages, as used for online documentation.
  277.      Translators exist for ppppoooodddd2222mmmmaaaannnn  (that's for _n_r_o_f_f(1) and _t_r_o_f_f(1)),
  278.      ppppoooodddd2222tttteeeexxxxtttt, ppppoooodddd2222hhhhttttmmmmllll, ppppoooodddd2222llllaaaatttteeeexxxx, and ppppoooodddd2222ffffmmmm.
  279.  
  280.      EEEEmmmmbbbbeeeeddddddddiiiinnnngggg PPPPooooddddssss iiiinnnn PPPPeeeerrrrllll MMMMoooodddduuuulllleeeessss
  281.  
  282.      You can embed pod documentation in your Perl scripts.  Start your
  283.      documentation with a "=head1" command at the beginning, and end it with a
  284.      "=cut" command.  Perl will ignore the pod text.  See any of the supplied
  285.      library modules for examples.  If you're going to put your pods at the
  286.      end of the file, and you're using an __END__ or __DATA__ cut mark, make
  287.      sure to put an empty line there before the first pod directive.
  288.  
  289.          __END__
  290.  
  291.          =head1 NAME
  292.  
  293.          modern - I am a modern module
  294.  
  295.      If you had not had that empty line there, then the translators wouldn't
  296.      have seen it.
  297.  
  298.      CCCCoooommmmmmmmoooonnnn PPPPoooodddd PPPPiiiittttffffaaaallllllllssss
  299.  
  300.      +o   Pod translators usually will require paragraphs to be separated by
  301.          completely empty lines.  If you have an apparently empty line with
  302.          some spaces on it, this can cause odd formatting.
  303.  
  304.      +o   Translators will mostly add wording around a L<> link, so that
  305.          L<foo(1)> becomes "the _f_o_o(1) manpage", for example (see ppppoooodddd2222mmmmaaaannnn for
  306.          details).  Thus, you shouldn't write things like the L<foo> manpage,
  307.          if you want the translated document to read sensibly.
  308.  
  309.          If you don need or want total control of the text used for a link in
  310.          the output use the form L<show this text|foo> instead.
  311.  
  312.      +o   The script _p_o_d/_c_h_e_c_k_p_o_d_s._P_L in the Perl source distribution provides
  313.          skeletal checking for lines that look empty but aren't oooonnnnllllyyyy, but is
  314.          there as a placeholder until someone writes Pod::Checker.  The best
  315.          way to check your pod is to pass it through one or more translators
  316.          and proofread the result, or print out the result and proofread that.
  317.          Some of the problems found may be bugs in the translators, which you
  318.          may or may not wish to work around.
  319.  
  320. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  321.      the _p_o_d_2_m_a_n manpage and the section on _P_O_D_s: _E_m_b_e_d_d_e_d _D_o_c_u_m_e_n_t_a_t_i_o_n in
  322.      the _p_e_r_l_s_y_n manpage
  323.  
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. PPPPEEEERRRRLLLLPPPPOOOODDDD((((1111))))                                                          PPPPEEEERRRRLLLLPPPPOOOODDDD((((1111))))
  335.  
  336.  
  337.  
  338. AAAAUUUUTTTTHHHHOOOORRRR
  339.      Larry Wall
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.                                                                         PPPPaaaaggggeeee 6666
  394.  
  395.  
  396.  
  397.